package com.granada.service.base;

import com.granada.behaviour.interfaces.UserRoleBehavior;
import com.granada.behaviour.interfaces.*;

import java.util.List;

public abstract class UserRoleService<T> implements UserRoleBehavior {
    UserRoleBehavior userRoleBehavior;

    protected UserRoleService(UserRoleBehavior userRoleBehavior){
        this.userRoleBehavior = userRoleBehavior;
    }

    public  void addBatch(List<Long> roleIds, Long userId){
        this.userRoleBehavior.addBatch(roleIds,userId);
    }

    @Override
    public void removeByRoleId(Long roleId) throws Exception {
        this.userRoleBehavior.removeByRoleId(roleId);
    }

    @Override
    public List<Long> getRoleIdsByUserId(Long userId) throws Exception {
        return this.userRoleBehavior.getRoleIdsByUserId(userId);
    }

    @Override
    public void removeByUserId(Long userId) throws Exception {
        this.userRoleBehavior.removeByUserId(userId);
    }

    @Override
    public List<Long> getUserIdsByRoleIds(List<Long> roleIds) throws Exception {
        return this.userRoleBehavior.getUserIdsByRoleIds(roleIds);
    }


}
